<?php

class Application_Model_Cliente extends Application_Model_Abstract {

    public function __construct() {
        $this->_dbTable = new Application_Model_DbTable_Cliente();
    }

    public function findWithAdd($id) {
        $retCli = $this->_dbTable->find($id)->current();
        $retAllCliData = $retCli->findDependentRowset("Application_Model_DbTable_ClienteEnderecos");

        $data["Cliente"] = $retCli->toArray();
        $i = 0;
        foreach ($retAllCliData as $row):
           $data["Endereco"][$i] = array(
                "Codigo" => $Cli["Codigo"],
                "Razao_Social" => $Cli["Razao_Social"],
                "CEP" => $row->CEP,
                "Logradouro" => $row->Logradouro
            );
            $i++;
        endforeach;
        return $data;
    }
}

